//
//  LSYEditorImageView.m
//  TTClub
//
//  Created by xkun on 15/10/10.
//  Copyright © 2015年 TTClub. All rights reserved.
//

#define DefaultSpace          5.5

#import "LSYEditorImageView.h"
#import <Masonry.h>
@implementation LSYEditorImageView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUPUI];
    }
    return self;
}

- (void)setUPUI
{
    self.userInteractionEnabled = YES;

    
    [self addSubview:self.showImageView];
    [self.showImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(DefaultSpace);
        make.right.mas_equalTo(-DefaultSpace);
        make.top.mas_equalTo(DefaultSpace);
        make.bottom.mas_equalTo(-DefaultSpace);
    }];
    
    UIImageView *delImageView = [[UIImageView alloc]init];
    [delImageView setImage:[UIImage imageNamed:@"del_icon"]];
    [self addSubview:delImageView];
    [delImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.width.mas_equalTo(DefaultSpace * 2);
        make.height.mas_equalTo(DefaultSpace * 2);
    }];
    
}

#pragma mark - getter

- (UIImageView *)showImageView
{
    if (!_showImageView) {
        _showImageView = [[UIImageView alloc]init];
        [_showImageView setContentMode:UIViewContentModeScaleAspectFill];
        [_showImageView setClipsToBounds:YES];
        _showImageView.userInteractionEnabled = YES;
    }
    return _showImageView;
}

@end
